import pymysql

cxk = pymysql.connect(host='localhost', port=3306, user='root', password='root', database='class_db', charset='utf8')
taimei = cxk.cursor()

sql = 'insert into student(stu_no,stu_name,stu_age,money) values ("itsrc-0014","大王八",33,500)'
try:
    row = taimei.execute(sql)
    print(row)

    cxk.commit()
except Exception as f:
    print(f)
    cxk.rollback()
finally:
    taimei.close()
    cxk.close()

